import request from '@/utils/request'

/**
 * User login (mobile phone)
 * @param {*} data
 * @returns
 */
export function login(data) {
  return request({
    url: '/register/login',
    method: 'post',
    data
  })
}

/**
 * User login (mailbox)
 * @param {*} data
 * @returns
 */
export function loginEmail(data) {
  return request({
    url: '/registerEmail/login',
    method: 'post',
    data
  })
}
/**
 * @param {Object} data
 */
export function logout(data) {
  return request({
    url: '/register/stopMining.do',
    method: 'post',
    data
  })
}
/**
 * GET IP
 * @returns
 */
export function getIP() {
  return request({
    url: 'ipServer', //process.env.NODE_ENV_IPSERVER,
    method: 'get'
  })
}

/**
 * Obtain Facebook user information based on accesstoken
 * @param {*} accesstoken
 * @returns
 */
export function getFaceBookUser(accesstoken) {
  return request({
    url: `https://graph.facebook.com/me?access_token=${accesstoken}`,
    method: 'get'
  })
}

/**
 * facebook Login
 */
export function registerFacebook(data) {
  return request({
    url: 'registerFacebook/login',
    method: 'post',
    data
  })
}

export function getPersonalInfo(data) {
	return request({
		url: '/api/getPersonalInfo',
		method: 'post',
		data
	})
}